﻿<%
'API 接口核心,外部不要引用
'TODO 插件与配置没有直接关联,最好不要直接读取配置

'不允许直接引用
API_NO_ALLOW

'当前时间
Dim API_START,API_NOW,API_DATE,API_TIME
API_START = Timer
API_NOW = Now
API_DATE = Date
API_TIME = Time

'数据库地址
Dim db,dbm
'后台地址
Dim wapadmin,webadmin
'网站全局配置变量
Dim wapstyle,waptitle,wapurl,wapconst,wapreport,wapfavor,waplink,wapday,wapdayname,waphits,wapguest,waplast,waplastc,waplogin,wapdiscuss
Dim stylebodycolor,stylebodyimage,stylefontsize,stylemaincolor,stylemainborder,stylenavcolor,stylenavborder,stylelinkcolor,stylelinkhover,styletipcolor,styleoddcolor,stylecssextend
Dim numtitle,numdiscuss,numlist,numarticle,numbbslist,numtopicmin,numtopicmax,numreplymin,numreplymax,numhit,numbbshit
Dim bbsreg,bbsagree,bbssid,bbsmsgkeep,bbsip,bbsessay,bbsmoney
Dim adminipcheck,admintimecheck,adminupload,adminarticle,adminupdate,adminsize
Dim cssstyle,timediff
Dim tplarticle,tpllist,tpltopic,tplpost
%>
<!--#include file="db.asp"-->
<!--#include file="config.asp"-->
<%
'配置出错时启用,降低耦合
If waptitle="" Then waptitle="无名网站"'网站名称
If wapurl="" Then wapurl="74hu.cn"'网站地址
If wapconst="" Then wapconst="left"'网站排版
If bbssid="" Then bbssid="sid"'论坛会话标识
If bbsmoney="" Then bbsmoney="金币"'论坛金币名称
If wapreport<>"1" And wapreport<>"0" Then wapreport="1"'全站显示公告
If waplogin<>"1" And waplogin<>"0" Then waplogin="1"'显示注册登录
If wapfavor<>"1" And wapfavor<>"0" Then wapfavor="1"'首页问候语
If waplink<>"1" And waplink<>"0" Then waplink="1"'首页链接
If waphits<>"1" And waphits<>"0" Then waphits="1"'文章显示点击率
If wapguest<>"1" And wapguest<>"0" Then wapguest="1"'留言审核显示
If bbsip<>"1" And bbsip<>"0" Then bbsip="1"'会员IP检测
If bbsessay<>"1" And bbsessay<>"0" Then bbsessay="1"'会员投稿
If wapdiscuss<>"1" And wapdiscuss<>"0" Then wapdiscuss="0"'文章评论
If Not IsDate(wapday) Then wapday=""'首页倒计时
'字数控制
If Not ifNum_(numhit) Then numhit="0"'文章点击种子
If Not ifNum_(numlist) Then numlist="10"'文章列表数
If Not ifNum_(numbbshit) Then numbbshit="0"'帖子点击种子
If Not ifNum_(numbbslist) Then numbbslist="10"'论坛列表数
If Not ifNum_(numarticle) Then numarticle="500"'文章每页字数
If Not ifNum_(numdiscuss) Then numdiscuss="0"'文章评论最少字数
If Not ifNum_(numtopicmin) Then numtopicmin="10"'帖子最少字数
If Not ifNum_(numtopicmax) Then numtopicmax="1000"'帖子最多字数
If Not ifNum_(numreplymin) Then numreplymin="0"'回帖最少字数
If Not ifNum_(numreplymax) Then numreplymax="200"'回帖最多字数
If Not ifNum_(bbsmsgkeep) Then bbsmsgkeep="10"'消息保存天数
If Not ifNum_(adminsize) Then adminsize="0"'后台上传限制

If ifNum_(timediff) Then
	API_NOW=dateadd("s", timediff, API_NOW)
	API_DATE=CDate(Year(API_NOW)&"-"&Month(API_NOW)&"-"&Day(API_NOW))
	API_TIME=CDate(Hour(API_NOW)&":"&Minute(API_NOW)&":"&Second(API_NOW))
End If

'判断全数字,用于快速检查
Function ifNum_(str)
	If str="" Or IsNumeric(str)=False Then ifNum_=False:Exit Function
	ifNum_=True
End Function

'生成时间字符串,用于生成文件名
Function getDate_()
	Dim sTime,sResult
	sTime=API_NOW
	sResult = Year(sTime)&right("0" & Month(sTime),2)&right("0" & Day(sTime),2)
	getDate_ = sResult
End Function


API_SID=bbssid
API_ADMIN_SID="sid"
'API_ERROR=-1'ERROR全部为负数
%>